import React, { useEffect, useState } from 'react'
import Gege from './components/Gege'
import DIdi from './components/Didi'

import pubsub from 'pubsub-js'


export default function App() {
  const [car, setCar] = useState("奥迪A8L")

  //初始化的时候订阅
  useEffect(() => {
    pubsub.subscribe("qiche", (_, data) => {
      setCar(data)
    })
  }, [])


  return (
    <div>
      <h1>我是App我也开哥哥的{car}</h1>
      <hr />
      <Gege />
      <hr />
      <DIdi />
    </div>
  )
}
